import numeral from 'numeral';

import { Pipe } from '../typings/Pipe';

// 数字格式化 Pipe
export const numberPipe: Pipe = {
  name: 'numberPipe',
  transform(
    value: any,
    options?: {
      format: string
    }
  ) {
    if(!options?.format){
      return value;
    }
    return numeral(value).format(options.format)
  }
}
